home *** CD-ROM | disk | FTP | other *** search
/ Windows Game Programming for Dummies (2nd Edition) / WinGamProgFD.iso / mac / DirectX SDK / DXSDK / samples / Multimedia / Direct3D / Water / CWater.h < prev    next >
C/C++ Source or Header  |  2001-10-08  |  1KB  |  69 lines

  1. //
  2. // CWater
  3. // Copyright (c) 2000-2001 Microsoft Corporation. All rights reserved.
  4. //
  5.  
  6. #pragma once
  7. #ifndef __CWATER_H__
  8. #define __CWATER_H__
  9.  
  10.  
  11. typedef struct WATER_REFRACT
  12. {
  13.     // Vrefract = (V + refract * N) * norm
  14.     float fRefract;
  15.     float fRefractNorm; 
  16.     DWORD dwDiffuse;
  17.  
  18. } WATER_REFRACT;
  19.  
  20.  
  21. typedef struct WATER_SURFACE
  22. {
  23.     float fHeight;
  24.     float fVelocity;
  25.  
  26. } WATER_SURFACE;
  27.  
  28.  
  29.  
  30. class CWater
  31. {
  32.     FLOAT m_fSize;
  33.     FLOAT m_fDepth;
  34.     FLOAT m_fScaleTex;
  35.     FLOAT m_fAvgHeight;
  36.  
  37.     FLOAT m_fSphereHeight;
  38.     FLOAT m_fSphereRadius2;
  39.  
  40.     UINT m_uIndices;
  41.     UINT m_uVertices;
  42.  
  43.     WATER_SURFACE *m_pSurface;
  44.     WATER_REFRACT *m_pRefract;
  45.  
  46.     IDirect3DDevice8       *m_pDevice;
  47.     IDirect3DIndexBuffer8  *m_pibIndices;
  48.     IDirect3DVertexBuffer8 *m_pvbVertices;
  49.     IDirect3DVertexBuffer8 *m_pvbCaustics;
  50.  
  51. public:
  52.     CWater();
  53.    ~CWater();
  54.  
  55.     HRESULT Initialize(float fSize, float fDepth);
  56.  
  57.     HRESULT OnCreateDevice(IDirect3DDevice8 *pDevice);
  58.     HRESULT OnResetDevice();
  59.     HRESULT OnLostDevice();
  60.     HRESULT OnDestroyDevice();
  61.  
  62.     HRESULT Drop();
  63.     HRESULT Update(D3DXVECTOR3 &vecPos, D3DXVECTOR3 &vecLight, BOOL bCalcCaustics);
  64.  
  65.     HRESULT DrawCaustics();
  66.     HRESULT DrawSurface();
  67. };
  68.  
  69. #endif // __CWATER_H__